#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int kMaxN = 2e5 + 10;

int a[kMaxN], prefix[kMaxN], suffix[kMaxN];

int CalcLIS(int st, int en, int dt, int f[]) {
  vector<int> lis;

  for (int i = st; i != en; i += dt) {
    int x = a[i] * dt;
    if (lis.empty() || lis.back() < x) {
      lis.emplace_back(x);
      f[i] = lis.size();
    } else {
      f[i] = lower_bound(lis.begin(), lis.end(), x) - lis.begin() + 1;
      lis[f[i] - 1] = x;
    }
  }
  return (int)lis.size();
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T; T--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }

    int L = CalcLIS(0, n, 1, prefix), m = 0;
    CalcLIS(n - 1, -1, -1, suffix);
    for (int i = 0; i < n; i++) {
      if (prefix[i] + suffix[i] == L + 1) {
        m++;
      }
    }
    cout << m << "\n";
    for (int i = 0; i < n; i++) {
      if (prefix[i] + suffix[i] == L + 1) {
        cout << i + 1 << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}